<template>
  <t-card class="dashboard-detail-card" :style="{ 'margin-bottom': '24px' }" v-if="boxShow">
    <div class="body-context">
      <div class="heard-box hw-flex-style-b-c">
        <div class="heard-box-left">
          <span class="heard-title">轻松上手</span>
          <span class="heard-title1">我们准备了基础的新手引导教程,带您快速开始策展之路</span>
        </div>
        <div class="action-box hw-click-cursor" @click="SetboxShow">
          <!-- <img
            class="action-box-img"
            src="https://static-1316349889.cos.ap-shanghai.myqcloud.com/assets/img/actionIcon.png"
            alt=""
          /> -->
          <span class="action-box-text"> <i class="doorIcon action-box-textIcon">&#xe636;</i>收起指引</span>
        </div>
      </div>
      <div class="center-box">
        <div class="center-item-parent" v-for="item in tabList" :key="item.type">
          <div class="center-item" v-if="!item.iconShow">
            <img :src="item.url" alt="" class="center-item-img" />
            <div class="center-item-right">
              <span class="center-item-right-title1"> {{ item.type }}. {{ item.title }} </span>
              <span class="center-item-right-title2">
                {{ item.remarks }}
              </span>
              <div class="center-item-right-title3" @click="clickBtn(item.type)" v-if="item.type !== 4">
                <span>{{ item.buttonText }}</span>
                <i class="doorIcon">&#xe636;</i>
              </div>
              <div class="center-item-right-title4" @click="clickBtn(item.type)" v-else>
                <span>{{ item.buttonText }}</span>
              </div>
            </div>
          </div>
          <div v-else class="iconShow-box">
            <img src="https://static-1316349889.cos.ap-shanghai.myqcloud.com/assets/img/doorAction.png" alt="" />
          </div>
          <!-- <div class="center-item">
            <div class="item-top">
              <span class="top-left">{{ item.type }}</span>
              <span class="top-right">{{ item.title }}</span>
            </div>
            <div class="item-center">
              <img :src="item.url" alt="" class="center-right" :class="{ 'center-right2': item.type == 2 }" />
              <span class="center-left">{{ item.remarks }}</span>
            </div>
            <div class="item-btm">
              <div class="btm-btn-box" @click="clickBtn(item.type)">
                <span>{{ item.buttonText }}</span>
              </div>
            </div>
          </div> -->
        </div>
      </div>
    </div>
  </t-card>
  <div v-else class="flex-btm-guide" @click="lookModel" :class="{ 'moveBox-d': moveShow }">
    <div class="flex-btm-guide-item">
      <img src="https://static-1316349889.cos.ap-shanghai.myqcloud.com/assets/img/guideImg.png" alt="" />
      <span>策展指引</span>
    </div>
  </div>
  <messageModel
    submitText="发布"
    title="提示"
    :visible="visibleMessage1"
    problem="模板发布"
    message="是否发布展览进行审核？"
    @closeClick="closeClick"
    @submitClick="pathSubmitClick"
  />
</template>

<script setup lang="ts">
// @ts-nocheck
import { doorUrl } from '@/utils/minxin';
import messageModel from '@/components/messageModel/index.vue';
import { useRoute } from 'vue-router';
import { asterisk, publishProjact, withdrawnProjact } from '@/api/project/project';
import { MessagePlugin } from 'tdesign-vue-next';
import { urls } from '@/utils/request/upload';
import { ref } from 'vue';
import { tabList } from './data';
import { useRouter } from 'vue-router';

const emit = defineEmits(['setStatus']);
const webUrls: string = '?imageView2/2/w/30/h/30/format/webp';
const visibleMessage1 = ref(false);
const moveShow = ref(false);
const route = useRoute();
const router = useRouter();
const boxShow = ref(false);
const props = defineProps({
  info: {
    type: Object,
  },
  role: {
    type: Number,
  },
});
const visible1 = ref(false);
const tableLayout = ref('fixed');
const lookModel = () => {
  moveShow.value = false;
  boxShow.value = true;
};
const setTemplateList = () => {
  let arr = [];
  let id = localStorage.getItem('projectId');
  let list = JSON.parse(localStorage.getItem('TemplateListArr'));
  if (list) {
    let indexs = list.findIndex((el) => {
      return el == id;
    });
    if (indexs == -1) {
      boxShow.value = true;
    } else {
      boxShow.value = false;
    }
  } else {
    boxShow.value = true;
  }
  //   console.log(list);
};
const setTemplateListPush = () => {
  let arr = [];
  let id = localStorage.getItem('projectId');
  let list = JSON.parse(localStorage.getItem('TemplateListArr'));
  if (list) {
    let indexs = list.findIndex((el) => {
      return el == id;
    });
    if (indexs == -1) {
      list.push(localStorage.getItem('projectId'));
      localStorage.setItem('TemplateListArr', JSON.stringify(list));
    } else {
    }
  } else {
    arr.push(localStorage.getItem('projectId'));
    localStorage.setItem('TemplateListArr', JSON.stringify(arr));
  }
  //   console.log(list);
};
setTemplateList();
const SetboxShow = () => {
  moveShow.value = true;
  boxShow.value = false;
  setTemplateListPush();
};
const lookWhole = () => {
  // router.push('/prijectMenu/member');
  router.push({ path: '/prijectMenu/member', query: { projectId: localStorage.getItem('projectId') } });
};
const closes = () => {
  visible1.value = false;
};
const clickBtn = (types: number) => {
  switch (types) {
    case 1:
      router.push({ path: '/prijectMenu/plan', query: { projectId: localStorage.getItem('projectId') } });
      break;
    case 2:
      router.push({ path: '/prijectMenu/exhibits', query: { projectId: localStorage.getItem('projectId') } });
      break;
    case 3:
      let projectId = localStorage.getItem('projectId');
      let url = doorUrl + 'portal/square?projectId=' + projectId;
      window.open(url, '_blank');
      break;
    case 4:
      console.log('触发');
      visibleMessage1.value = true;
      break;
  }
};
const closeClick = () => {
  //取消前往
  visibleMessage1.value = false;
};
const publish = async () => {
  //发布
  let { statusCode } = await publishProjact(localStorage.getItem('projectId'));

  if (statusCode == 200) {
    MessagePlugin.success('发布成功,等待审核通过');
    emit('setStatus', 2);
  }
};
const pathSubmitClick = () => {
  publish();
  visibleMessage1.value = false;
};
</script>

<style lang="less" scoped>
.body-context {
  display: flex;
  flex-direction: column;
  width: 100%;
  // height: 182px;
}

.heard-box {
  align-items: center;
  margin-bottom: 16px;
}
.heard-box-left {
  display: flex;
  align-items: center;
}
.heard-title {
  font-size: 18px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.8);
  line-height: 28px;
}
.heard-title1 {
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.38);
  line-height: 22px;
  margin-left: 8px;
}
.action-box {
  display: flex;
  align-items: center;
}
.action-box-img {
  width: 16px;
  height: 16px;
  margin-right: 4px;
}
.action-box-text {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.4);
  line-height: 22px;
}
.action-box-textIcon {
  font-size: 16px;
  color: rgba(0, 0, 0, 0.4);
  margin-right: 4px;
}
.action-box-text:hover {
  .action-box-textIcon {
    font-size: 16px;
    color: rgba(0, 0, 0, 0.59);
  }
  color: rgba(0, 0, 0, 0.59);
}

:deep(.t-card__body) {
  padding: 16px 24px;
  height: 100%;
}

.t-row {
  width: 100%;
  margin-top: 0;
  margin-right: 0;
  margin-left: 0;
}
.t-col {
  margin-bottom: 0;
}

.flex-btm-guide {
  cursor: pointer;
  position: fixed;
  bottom: 160px;
  right: 9px;
  z-index: 60;

  animation-iteration-count: 1;
  .flex-btm-guide-item {
    position: relative;
    width: 100px;
    height: 100px;
    img {
      width: 100px;
      height: 100px;
    }
    span {
      display: flex;
      align-items: center;
      justify-content: center;
      position: absolute;
      bottom: 19px;
      left: 2px;
      width: 100px;
      font-size: 12px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #ffffff;
      line-height: 18px;
    }
  }
}
.moveBox-d {
  animation: mymove 0.5s;
}
@keyframes mymove {
  from {
    bottom: calc(100vh - 100px);
    right: calc(100vh - 15px);
  }

  to {
    bottom: 160px;
    right: 9px;
  }
}

.center-box {
  display: flex;
  justify-content: space-between;
  width: 100%;
}
.center-item-parent {
  display: flex;
}

.center-item {
  display: flex;
  // width: 100%;
  min-width: 278px;
  // max-height: calc(100% - 38px);
}
.iconShow-box {
  display: flex;
  justify-content: center;
  width: 48px;
  margin-top: 48px;
  img {
    width: 16px;
    height: 16px;
  }
}
.center-item-img {
  width: 122px;
  height: 88px;
}
.center-item-right {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-left: 12px;
}
.center-item-right-title1 {
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.8);
  line-height: 24px;
  margin-bottom: 4px;
}
.center-item-right-title2 {
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: rgba(0, 0, 0, 0.38);
  line-height: 22px;
  margin-bottom: 8px;
  text-align: justify;
}
.center-item-right-title3 {
  display: flex;
  cursor: pointer;
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #e62b17;
  line-height: 24px;
  .doorIcon {
    font-size: 16px;
    color: #e62b17;
    transform: rotate(90deg);
    margin-left: 4px;
  }
}
.center-item-right-title4 {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 36px;
  border-radius: 4px;
  border: 1px solid #e62b17;
  font-size: 16px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #e62b17;
  line-height: 24px;
}
.center-item-right-title4:hover {
  background: #ffece6;
}
</style>
